//
//  LoginView.m
//  LQH-Douban
//
//  Created by lanou3g on 15/10/22.
//  Copyright © 2015年 lanou3g. All rights reserved.
//

#import "LoginView.h"

@implementation LoginView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self p_setupViews];
    }
    return self;
}

- (void)p_setupViews
{
    self.backgroundColor = [UIColor whiteColor];
    
    UILabel *label1 = [[UILabel alloc] init];
    label1.text = @"用户名:";
    label1.frame = CGRectMake(25, 64 + 40, 70, 40);
    [self addSubview:label1];
    
    self.userNameTf = [[UITextField alloc] init];
    self.userNameTf.frame = CGRectMake(CGRectGetMaxX(label1.frame) + 30, CGRectGetMinY(label1.frame), 200, 40);
    //    self.login.backgroundColor = [UIColor orangeColor];
    self.userNameTf.borderStyle = UITextBorderStyleRoundedRect;
    self.userNameTf.placeholder = @"请输入用户名";
    [self addSubview:self.userNameTf];
    

    UILabel *label2 = [[UILabel alloc] init];
    label2.text = @"密码:";
    label2.frame = CGRectMake(25, CGRectGetMaxY(label1.frame) + 40, 70, 40);
    //    self.label2.backgroundColor = [UIColor orangeColor];
    [self addSubview:label2];
    
    self.passwordTf = [[UITextField alloc] init];
    self.passwordTf.frame = CGRectMake(CGRectGetMaxX(label2.frame) + 30, CGRectGetMinY(label2.frame), 200, 40);
    //    self.password.backgroundColor = [UIColor orangeColor];
    self.passwordTf.borderStyle = UITextBorderStyleRoundedRect;
    self.passwordTf.placeholder = @"请输入密码";
    self.passwordTf.secureTextEntry = YES;
    [self addSubview:self.passwordTf];
    
    
    self.loginButton = [UIButton buttonWithType:(UIButtonTypeSystem)];
    self.loginButton.frame = CGRectMake(CGRectGetMinX(label2.frame), CGRectGetMaxY(label2.frame) + 40, 150, 40);
    self.loginButton.backgroundColor = [UIColor whiteColor];
    self.loginButton.layer.cornerRadius = 7;
    self.loginButton.layer.borderColor = [UIColor grayColor].CGColor;
    self.loginButton.layer.borderWidth = 1;
    [self.loginButton setTitle:@"登陆" forState:(UIControlStateNormal)];
    [self addSubview:self.loginButton];
    
    self.registerButton = [UIButton buttonWithType:(UIButtonTypeSystem)];
    self.registerButton.frame = CGRectMake(CGRectGetMaxX(self.loginButton.frame) + 30, CGRectGetMinY(self.loginButton.frame), 150, 40);
    self.registerButton.backgroundColor = [UIColor whiteColor];
    self.registerButton.layer.cornerRadius = 7;
    self.registerButton.layer.borderColor = [UIColor grayColor].CGColor;
    self.registerButton.layer.borderWidth = 1;
    [self.registerButton setTitle:@"注册" forState:(UIControlStateNormal)];
    [self addSubview:self.registerButton];
    
    
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
